package org.jeecg.modules.system.parse.impl;

import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.system.parse.IFileParse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.OutputStream;
import java.util.List;
import java.util.Map;

@Component
@Slf4j
public class FileParseDelegate{

    @Autowired
    private List<IFileParse> fileParseList;


    public void parse(String url, Map<String,Object> dataMap, OutputStream outputStream) {
        for (IFileParse item : fileParseList) {
            if(item.support(url)){
                item.parse(url,dataMap,outputStream);
                return;
            }
        }
        log.warn("不存在该文件解析器");
    }
}
